{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from Magics.macro import *\n",
    "#setting the output\n",
    "output = output(   \n",
    "                output_formats = ['png'],\n",
    "                output_name = \"snowFall\",\n",
    "                output_name_first_page_number = \"off\",\n",
    "               \n",
    "        )\n",
    "#settings of the geographical area\n",
    "area = mmap(subpage_map_projection=\"cylindrical\",\n",
    "        subpage_lower_left_longitude=90.,\n",
    "        subpage_lower_left_latitude=30.,\n",
    "        subpage_upper_right_longitude=130.,\n",
    "        subpage_upper_right_latitude=55.,\n",
    "        page_id_line = 'off',\n",
    "        map_grid_latitude_increment = 2.00,\n",
    "        map_grid_longitude_increment = 2.00,\n",
    "    )    \n",
    " #settings of the caostlines\n",
    "coast = mcoast(\n",
    "      map_coastline_land_shade = \"on\",\n",
    "      map_cities = \"on\",\n",
    "      map_administrative_boundaries_countries_list = [\"CHN\"],\n",
    "      map_administrative_boundaries_colour = \"orange\",\n",
    "      map_rivers = \"on\",\n",
    "      map_administrative_boundaries = \"on\",\n",
    "      map_coastline_land_shade_colour = \"cream\",\n",
    "      map_grid_line_style = \"dash\",\n",
    "      map_grid_colour = \"grey\",\n",
    "      map_label = \"on\",\n",
    "      map_coastline_colour = \"grey\")\n",
    "#definition of the input data\n",
    "snowFall = mgrib(grib_input_file_name=\"sf_0_20180406.grib1\",\n",
    "    #grib_automatic_scaling='off',\n",
    "    #grib_scaling_factor=100.\n",
    "                )\n",
    "shading = mcont( \n",
    "   contour_hilo= \"off\",\n",
    "    contour_label=\"off\",\n",
    "    contour_level_list=[0.5,2,4,10., 25., 50., 100., 250.],\n",
    "    contour_level_selection_type= \"level_list\",\n",
    "    contour_shade= \"on\",\n",
    "    contour_shade_method= \"area_fill\",\n",
    "    contour_shade_colour_method= \"list\",\n",
    "    contour_shade_colour_list= [\"cyan\", \"greenish_blue\", \"blue\", \"bluish_purple\", \"magenta\", \"orange\", \"red\", \"charcoal\"],\n",
    "    legend=\"on\"\n",
    ")\n",
    "\n",
    "#Definition of the legend\n",
    "legend = mlegend(legend='on',\n",
    "            legend_display_type='continuous',\n",
    "            legend_text_colour='charcoal',\n",
    "            legend_text_font_size=0.4,\n",
    "            )  \n",
    "\n",
    "title = mtext(\n",
    "        text_lines= [\n",
    "        '<magics_title/>'],\n",
    "        text_html= 'true',\n",
    "        text_justification= 'left',\n",
    "        text_font_size= 0.8,\n",
    "        text_colour= 'charcoal',\n",
    "        )\n",
    "\n",
    "plot(area, coast,snowFall,shading,legend,title)"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 2",
   "language": "python",
   "name": "python2"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 2
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython2",
   "version": "2.7.5"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
